import {
      getSizeParams,
      getPositionParams,
      getBackgroundParams,
} from "./params";
import { positionType } from "@/types/form";
const layout = function () {
      return {
            formComponents: {
                  SizeForm: getSizeParams(),
                  BackgroundForm: getBackgroundParams(),
            },
            viewComponentTitle: "布局组件",
      };
};

const Text = function (positionOptions: positionType) {
      const PositionForm = positionOptions || {};
      return {
            formComponents: {
                  SizeForm: getSizeParams(80, 30),
                  TextForm: {
                        title: "文本属性",
                        property: {
                              textAlign: "left",
                              color: "",
                              lineHeight: "30",
                              fontSize: "14",
                              fontWeight: "normal",
                        },
                        subject: {
                              text: "文本",
                        },
                  },
                  BackgroundForm: getBackgroundParams(),
                  PositionForm: getPositionParams(PositionForm),
            },
            viewComponentName: "Text",
            viewComponentTitle: "文本",
      };
};

const Button = function (positionOptions: positionType) {
      const PositionForm = positionOptions || {};
      return {
            formComponents: {
                  ButtonForm: {
                        property: {
                              align: "center",
                              lineHeight: "32",
                              backgroundImage: "",
                              backgroundColor: "",
                        },
                        subject: {
                              text: "按钮",
                        },
                  },
                  SizeForm: getSizeParams(80, 32),
                  PositionForm: getPositionParams(PositionForm),
            },
            viewComponentName: "Button",
            viewComponentTitle: "按钮",
      };
};

const componentParamsFnMap: { [key: string]: any } = {
      layout,
      Text,
      Button,
};

export default componentParamsFnMap;
